package com.user_hosted_storage.dto;

import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class CommunityMemberDTO extends DTO {

	public enum State {
		INVITED,
		JOINED
	}
	
	private long sharedSize;
	
	private double usedSpace;
	
	private ClientDTO client;
	
	private CommunityDTO community;
	
	private State state;
	
	public long getSharedSize() {
		return sharedSize;
	}

	public void setSharedSize(long sharedSize) {
		this.sharedSize = sharedSize;
	}

	public double getUsedSpace() {
		return usedSpace;
	}

	public void setUsedSpace(double usedSpace) {
		this.usedSpace = usedSpace;
	}

	public ClientDTO getClient() {
		return client;
	}

	public void setClient(ClientDTO client) {
		this.client = client;
	}

	public CommunityDTO getCommunity() {
		return community;
	}
	
	public void setCommunity(CommunityDTO community) {
		this.community = community;
	}
	
	public State getState() {
		return state;
	}
	
	public void setState(State state) {
		this.state = state;
	}
	
	@Override
	public int hashCode() {
		return ((Long)id).hashCode();
	}
	
	@Override
	public boolean equals(Object obj) {
		if(obj == null || !(obj instanceof CommunityMemberDTO)) {
			return false;
		}
		
		CommunityMemberDTO communityMember = (CommunityMemberDTO) obj;
		return id == communityMember.id;
	}
	
}
